<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-07-15 15:11
 *
 * Version: 2.0
 */

namespace App\Exceptions;

use Throwable;

class BaseException extends \Exception
{
	// HTTP 状态码 400，200
	public $statusCode = 400;
	// 具体错误
	public $msg = "params error";
	//自定义错误码
	public $errorCode = 10000;

	public function __construct($params = [])
	{
		// 不是数组 则保持默认
		if(!is_array($params)){
			return ;
		}
		$this->statusCode = array_key_exists('statusCode',$params) ? $params['statusCode'] : $this->statusCode;
		$this->msg = array_key_exists('msg',$params) ? $params['msg'] : $this->msg;
		$this->errorCode = array_key_exists('errorCode',$params) ? $params['errorCode'] : $this->errorCode;
	}

}